<?php
//控制器

class update extends mysql
{
    function userup()
    {
        $id = $_SESSION['up_id'];
        $sql = "select * from message where id = $id";
        $data = $this->select_one($sql);
        $text = $data['text'];
        //修改
        if (isset($_REQUEST['update2'])) {
            if (!empty($_POST)) {
                $text = $_POST['text'];
                //"UPDATE message SET text = '".$text."' WHERE  id = $id;";
                $data = array(
                    'text' => $text
                );
                $table = 'message';
                $where = "id = $id";
                $ints = $this->update($data, $table, $where);
                if ($ints == true) {
                    $this->success(0,'index','home','userhome',"修改成功。");
                } else {
                    $this->alert_str("修改失败！");
                }
            }
        }

        $this->display('index', 'index', 'update', ['url' => $this->config,'js' => $this->js ,'ueditor' => $this->ueditor, 'text' => $text]);
    }
}